The appearance and layout of a typical text document, e.g. a word processing document or a media presentation document, is determined by the selection of fonts used to display the characters which comprise the text document. To accurately render a text document, often it is necessary to vary the size or resolution of the font, depending on the display or printer used to view the contents of the document.
Mathematical algorithms are used to scale a font character and render the font characters at various sizes and resolutions. However, as a font size and display or printer resolution is varied, anomalies or imperfections occur in characters to be rendered. Different techniques have been developed to address these issues. One mathematical scheme to correct font scaling and resolution errors and to restore character aesthetics is referred to as hinting. Hinting corrects the pixels of a font character scaled to a given size and resolution using any number of techniques for restoring the native shape, aesthetics and legibility of the character.
Hinting consists of making minor corrections to the outline of a font character. For example, at low resolution, rounding effects may result in portions of a character disappearing, or other parts appearing too thick or too thin. Hinting addresses these and other anomalies by equalizing the weights of stems and preventing parts of glyphs from disappearing as the rendering resolution is decreased.
One type or family of fonts, which are mathematically scalable, are TrueType fonts. In TrueType fonts, each glyph or character form contains a respective hint program, i.e. a script or algorithm, which includes instructions for manipulating various control points of the respective glyph outline just prior to rasterization. As a result, the outline of the glyph is mathematically altered by the respective glyph's hinting instruction to surround only the pixels that produce a desired bitmap image of the glyph. The hinting instruction of TrueType fonts includes loops, conditional branches, user-definable functions, instructions to move, align and interpolate points in various ways—often with reference to “control values,” methods to round points to the “grid” of the device, and arithmetic and logical instructions.
The TrueType hinting language is “stack-based,” like PostScript®, meaning that the instructions take all their arguments from the stack. Instructions take the form of single-byte codes. However, unlike PostScript®, there are explicit PUSH instructions to push bytes and words from the instruction stream (these are the only instructions to take arguments from the stack).
Prior to applying one or more hints specific to a glyph, the glyph is scaled with respect to the current pixels-per-em, (hereinafter “ppem”). The ppem value is a measure of the number of pixels available for rasterization, derived from point-size and resolution. All the glyph's coordinates are measured in fractional pixels, rather than integral font design units. Coordinates are “F26DOT6” values: 32-bit fixed-point numbers with six fractional bits. Each point is stored twice: once for its original position, once for its current “instructed” position.
There are instructions for absolute and relative movements with measurements taken from the stack, the Control Value Table (hereinafter, “CVT”), or from other points that have already been moved. All moving of points takes place with respect to two vectors: the Projection Vector P, along which all measurements are taken, and the Freedom Vector F, along which movement actually occurs. Flexibility of TrueType font rendering lies, in part, from the independence of these vectors, and the ability to set them diagonally.
One important objective of hinting is to preserve the “spirit” of a typeface throughout all its characters or glyphs. This is the purpose of TrueType's CVT. It should contain measurements that are used frequently within the hints for each glyph. The CVT is always “scaled” to the current ppem. Sample CVT entries might be: how thick are the vertical stems, how thick are the horizontal stems, how thick are the serifs, and by how much do round features overshoot the baseline?
During rendering, it may be necessary to manipulate points that are not part of the final outline. In TrueType, the non-outline points, referred to as “twilight zone points” are often initialized in the CVT Program (‘prep’). Values in the each fonts' ‘maxp’ table declare the number of twilight points and storage locations.
These prior methods of executing respective correction programs to render each font glyph or character consumes a huge amount of computer power and time when displaying characters. What is needed in the art is a method of streamlining font hinting which more efficiently renders characters.